<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
  <title>JSON-RPC DOJO example</title>
    <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.0.0/dojo/dojo.xd.js"></script>

  <script type="text/javascript">
  djConfig.usePlainJson = true;
  dojo.require('dojo.rpc.JsonService');
  var proxy;
  function setup() {
    var smdURL = 'api.php';
    proxy = new dojo.rpc.JsonService({serviceUrl: smdURL ,
    methods: [
        {
            name: 'addurl',
            parameters: [{name: 'url'}]
        }
    ]});
  }

  function addurlBack(result) {
      alert(result);
  }

  function addurl() {
     proxy.addurl(dojo.byId('url_field').value).addCallback(addurlBack);
  }

  dojo.addOnLoad(setup);
  </script>
</head>
<body>
<h1>JSON-RPC DOJO example</h1>
<p>
  This example shows, how Stubbles JSON-RPC functionality can be used with
  Dojo's JSON-RPC package. The example makes use of the integrated SMD generator.
</p>
<p>
  See the <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/ajax-transports/remote-procedure-call-rpc" target="_blank">Dojo documentation</a> for more information
  on JSON-RPC with the Dojo toolkit.
</p>
<fieldset>
  <legend>HTML RPC example</legend>
  URL: <input type="text" id="url_field" /><br/>

  <input type="button" onclick="addurl();" value="Send URL"/>
</fieldset>
<body>
</body>
</html>